// eslint-disable-next-line
import {
  UserLayout,
  BasicLayout,
  BlankLayout,
  PageView,
  RouteView
} from '@/layouts'

export const asyncRouterMap = [{
  path: '/',
  name: 'index',
  component: BasicLayout,
  meta: {
    title: '首页'
  },
  redirect: '/data/index',
  children: [
    // dashboard
    {
      path: '/data/index',
      name: 'dataIndex',
      component: () =>
        import('@/viewsVue/index/DataIndex'),
      meta: {
        title: '首页',
        icon: 'bar-chart'
      }
    },
    {
      // 分类管理
      path: '/manage',
      redirect: '/manage/index',
      component: PageView,
      meta: {
        title: '分类管理',
        icon: 'appstore'
      },
      children: [
        {
          path: '/manage/index',
          name: 'manageList',
          component: RouteView,
          redirect: '/manage/index',
          meta: {
            title: '分类列表'
          },
          children: [
            {
              path: '/manage/index',
              name: 'manageList',
              component: () =>
              import('@/viewsVue/manage/ManageList.vue'),
              meta: {
                title: '列表'
              }
            },
            {
              path: '/manage/index/child/:id',
              name: 'childList',
              component: () =>
                import('@/viewsVue/manage/children/ChildManage'),
              meta: {
                title: '子类别',
                parentPath: '/manage/index'
              }
            }
          ]
        }]
    }, {
      // 应用管理
      path: '/into',
      redirect: '/into/manage',
      component: PageView,
      meta: {
        title: '应用管理',
        icon: 'laptop'
      },
      children: [
        {
          path: '/into/manage',
          name: 'intoList',
          component: RouteView,
          redirect: '/into/manage',
          meta: {
            title: '应用列表'
          },
          children: [
            {
              path: '/into/manage',
              name: 'intoList',
              component: () =>
              import('@/viewsVue/into/IntoList.vue'),
              meta: {
                title: '列表'
              }
            }, {
              path: '/into/manage/add',
              name: 'intoAdd',
              component: () =>
                import('@/viewsVue/into/children/IntoChild'),
              meta: {
                title: '添加',
                parentPath: '/into/manage'
              }
            }, {
              path: '/into/manage/seen/:id',
              name: 'intoSeen',
              component: () =>
                import('@/viewsVue/into/children/IntoChild'),
              meta: {
                title: '查看',
                seen: true,
                parentPath: '/into/manage'
              }
            }, {
              path: '/into/manage/edit/:id',
              name: 'intoEdit',
              component: () =>
                import('@/viewsVue/into/children/IntoChild'),
              meta: {
                title: '编辑',
                parentPath: '/into/manage'
              }
            }
          ]
        }]
    }, {
      // 用户管理
      path: '/user',
      redirect: '/user/private',
      component: PageView,
      meta: {
        title: '用户管理',
        icon: 'user'
      },
      children: [{
        path: '/user/private',
        name: 'userList',
        component: () =>
          import('@/viewsVue/user/UserList'),
        meta: {
          title: '用户管理'
        }
      }]
    }, {
      // 数据报表
      path: '/data',
      redirect: '/data/count',
      component: PageView,
      meta: {
        title: '数据报表',
        icon: 'fund'
      },
      children: [{
        path: '/data/count',
        name: 'countList',
        component: () =>
          import('@/viewsVue/data/DataCount'),
        meta: {
          title: '应用统计'
        }
      }, {
        path: '/data/review/list',
        name: 'reviewList',
        component: () =>
          import('@/viewsVue/data/ReviewList'),
        meta: {
          title: '评论列表'
        }
      }, {
        path: '/data/review/sensitive',
        name: 'sensitiveList',
        component: () =>
          import('@/viewsVue/data/SensitiveWord'),
        meta: {
          title: '敏感词管理'
        }
      }, {
        path: '/data/download/log',
        name: 'loadLogList',
        component: () =>
          import('@/viewsVue/data/log/DownloadLog'),
        meta: {
          title: '下载日志'
        }
      }, {
        path: '/data/add/log',
        name: 'addLogList',
        component: () =>
          import('@/viewsVue/data/log/AddLog'),
        meta: {
          title: '添加日志'
        }
      }, {
        path: '/data/try/log',
        name: 'tryLogList',
        component: () =>
          import('@/viewsVue/data/log/TryLog'),
        meta: {
          title: '试用日志'
        }
      }]
    }, {
      // 审核管理
      path: '/audit',
      redirect: '/audit/list',
      component: PageView,
      meta: {
        title: '审核管理',
        icon: 'shop'
      },
      children: [{
        path: '/audit/list',
        name: 'auditList',
        component: () =>
          import('@/viewsVue/audit/AuditList'),
        meta: {
          title: '应用审核'
        }
      }]
    }, {
      // 广告管理
      path: '/ads',
      redirect: '/ads/manage',
      component: PageView,
      meta: {
        title: '广告管理',
        icon: 'fork'
      },
      children: [
        {
          path: '/ads/manage',
          name: 'adsList',
          component: RouteView,
          redirect: '/ads/manage',
          meta: {
            title: '广告列表'
          },
          children: [
            {
              path: '/ads/manage',
              name: 'adsList',
              component: () =>
                import('@/viewsVue/ads/AdsList'),
              meta: {
                title: '列表'
              }
            }, {
              path: '/ads/manage/add',
              name: 'addAds',
              hidden: true,
              component: () =>
                import('@/viewsVue/ads/children/AddAds'),
              meta: {
                title: '广告新增',
                parentPath: '/ads/manage'
              }
            }, {
              path: '/ads/manage/edit/:id',
              name: 'editAds',
              hidden: true,
              component: () =>
                import('@/viewsVue/ads/children/AddAds'),
              meta: {
                title: '广告编辑',
                parentPath: '/ads/manage'
              }
            }
          ]
        }]
    }, {
      // 系统管理
      path: '/system',
      redirect: '/system/role',
      component: PageView,
      meta: {
        title: '系统管理',
        icon: 'setting'
      },
      children: [
        {
          path: '/system/role',
          name: 'roleList',
          redirect: '/system/role',
          component: RouteView,
          meta: {
            title: '角色列表'
          },
          children: [
            {
              path: '/system/role',
              name: 'roleList',
              component: () =>
                  import('@/viewsVue/system/SystemRole'),
              meta: {
                title: '列表'
              }
            }, {
              path: '/system/role/add',
              name: 'roleAdd',
              hidden: true,
              component: () =>
                  import('@/viewsVue/system/children/RoleAdd'),
              meta: {
                title: '新增角色',
                parentPath: '/system/role'
              }
            }, {
              path: '/system/role/edit/:id',
              name: 'roleEdit',
              hidden: true,
              component: () =>
                  import('@/viewsVue/system/children/RoleEdit'),
              meta: {
                title: '编辑角色',
                parentPath: '/system/role'
              }
            }
          ]
        }, {
          path: '/system/log',
          name: 'roleLog',
          component: () =>
            import('@/viewsVue/system/SystemLog'),
          meta: {
            title: '操作日志',
            keepAlive: false
          }
        }, {
          path: '/system/manager',
          name: 'managerList',
          component: () =>
          import('@/viewsVue/system/SystemManager'),
          meta: {
            title: '管理员'
          }
        }]
    }
  ]
}, {
  path: '*',
  redirect: '/404',
  hidden: true
}]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [{
  path: '/user',
  component: UserLayout,
  redirect: '/user/login',
  hidden: true,
  children: [{
    path: 'login',
    name: 'login',
    component: () =>
        import(/* webpackChunkName: "user" */ '@/views/user/Login')
  }, {
    path: 'register',
    name: 'register',
    component: () =>
        import(/* webpackChunkName: "user" */ '@/views/user/Register')
  }, {
    path: 'register-result',
    name: 'registerResult',
    component: () =>
        import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
  }, {
    path: 'recover',
    name: 'recover',
    component: undefined
  }]
},

{
  path: '/test',
  component: BlankLayout,
  redirect: '/test/home',
  children: [{
    path: 'home',
    name: 'TestHome',
    component: () =>
        import('@/views/Home')
  }]
},

{
  path: '/404',
  component: () =>
      import(/* webpackChunkName: "fail" */ '@/views/exception/404')
}
]
